import { Entity, PrimaryGeneratedColumn, Column, OneToOne, JoinColumn } from "typeorm";
import { ContractEntity } from "./contract.entity";

@Entity({
  name: "signing_contract"
})
export class SigningContractEntity {
  @PrimaryGeneratedColumn({ type: "bigint", unsigned: true, comment: "id" })
  id: number;

  @Column({ type: "int", unsigned: true, default: 0, comment: "合同id" })
  contract_id: number;

  @Column({ type: "int", unsigned: true, default: 0, comment: "用户id" })
  user_id: number;

  @Column({ type: "varchar", length: 150, nullable: false, default: "", comment: "合同编码" })
  contract_no: string;

  @Column({ type: "varchar", length: 20, nullable: false, default: "", comment: "孩子姓名" })
  childs_name: string;

  @Column({ type: "varchar", length: 50, nullable: false, default: "", comment: "家长微信" })
  parent_wechat: string;

  @Column({ type: "varchar", length: 20, nullable: false, default: "", comment: "家长电话" })
  parent_phone: string;

  @Column({ type: "varchar", length: 30, nullable: false, default: "", comment: "分阶情况" })
  grading_situation: string;

  @Column({ name: "document_url", type: "varchar", length: 255, nullable: false, default: "", comment: "合同地址" })
  documentUrl: string;

  @Column({ type: "tinyint", unsigned: true, default: 0, comment: "是否同意" })
  is_agree: number;

  @Column({ type: "int", unsigned: true, default: 0, comment: "签约时间" })
  success_at: number;

  @Column({ type: "int", unsigned: true, default: 0, comment: "创建时间" })
  created_at: number;

  @Column({ type: "int", unsigned: true, default: 0, comment: "过期时间" })
  expired_at: number;

  @Column({ type: "int", unsigned: true, default: 0, comment: "删除时间" })
  deleted_at: number;

  @OneToOne(() => ContractEntity)
  @JoinColumn({ name: "contract_id" })
  contract: ContractEntity;
}
